/**
 * Created by Administrator on 2017/12/4.
 */
import React from 'react';
import {
    R_header_fixed
} from '../common/index'
import {
    HttpService,
    Tips
} from '../../Tools'
import Sunflower from './img/sunflower.jpg'
import Banner from '../../img/shengji/1.png'
import {Button} from 'antd'
import './style/business.scss'
export  default  class OrderDetail extends React.Component {
    constructor(props) {
        super(props);
        this.state={
            dataList:[],
            number:'',
            name:'',
            phone:''
        }
    }

    componentWillMount(){

    }
    componentDidMount() {
        const id=this.props.params.id;
        HttpService.query({
            url: '/jf/business/order/pageOrderGoods',
            data: {
                token: localStorage.btoken,
                page: 1,
                size: 10,
                orderSerialNum:id
            },
            success: (res => {
                if (res.code == "10140") {
                    this.setState({
                        dataList: res.data.list,
                        number:res.data.list[0].orderSerialNum,
                        name:res.data.list[0].peoplename,
                        phone:res.data.list[0].peopletel
                    });
                }else{
                    Tips(res.data);
                }

            })
        })
    }

    render() {
        const {dataList,number,name,phone,peoplename}=this.state;
        let dataLists= dataList.map(function (item) {
            return (
                <ul className="orderInfo">
                    <li>
                        <label htmlFor="">商品名称：</label>
                        <span>{item.name}</span>
                    </li>
                    <li>
                        <label htmlFor="">商品金额：</label>
                        <span>{item.consumeCredit}</span>
                    </li>
                    <li>
                        <label htmlFor="">商品券号：</label>
                        <span>{item.serialNumber}</span>
                    </li>
                    <li>
                        <label htmlFor="">消费状态：</label>
                        <span className="useStatus"><span className="used">{item.usedtimes>0?'已消费':'未消费' }</span><span>{item.usedtimes+'/ '+item.usetimes }</span></span>
                    </li>
                </ul>
            )
        }.bind(this))
        return (
            <div className="orderDetail" >
                <R_header_fixed left="1" title="订单详情"/>
                <div className="orderbox">
                    <ul className="orderNo">
                        <li>
                            <label htmlFor="">订单编号：</label>
                            <span>{number}</span>
                        </li>
                    </ul>
                    {dataLists}

                    {/*<h4>使用人信息</h4>*/}
                    {/*<ul className="useInfo">*/}
                        {/*<li>*/}
                            {/*<label htmlFor="">姓名：</label>*/}
                            {/*<span>{name}</span>*/}
                        {/*</li>*/}
                        {/*<li>*/}
                            {/*<label htmlFor="">手机号：</label>*/}
                            {/*<span>{phone}</span>*/}
                        {/*</li>*/}
                    {/*</ul>*/}

                </div>
            </div>

        )
    }
}